<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:64:"/www/wwwroot/xunda-college/application/atxunda/view/nav/nav.html";i:1700617178;s:69:"/www/wwwroot/xunda-college/application/atxunda/view/index/header.html";i:1700617178;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="__PUBLIC__css/pintuer.css?v=1.0">
<link rel="stylesheet" href="__PUBLIC__admin/admin.css">
<link rel="stylesheet" href="__PUBLIC__layui/css/layui.css">
<script src="__PUBLIC__js/jquery.js"></script>
<script src="__PUBLIC__js/pintuer.js"></script>
<script src="__PUBLIC__js/cookie.js"></script>
<script src="__PUBLIC__layui/layui.js"></script>
</head>
<style type="text/css">
	.refresh{width: 20px;height: 20px;float: right;margin:10px 20px;display: block;}
</style>
</head>
<?php if(request()->controller() != 'Index'): ?><img src="__PUBLIC__images/refresh.png" class="refresh" title="刷新"><?php endif; ?>
<script type="text/javascript">
	$('.refresh').click(function(){layer.msg('刷新中……');window.location.reload();})
</script>
<script type="text/javascript">
	function openwinx(url,name,w,h) {
		if(!w) w=screen.width-4;
		if(!h) h=screen.height-95;
		window.open(url,name,"width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
	}
</script>
<body>
	<div class="panel admin-panel">
		<div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
		<div class="padding border-bottom">  
			<button type="button" class="button border-yellow" onclick="window.location.href='<?php echo url('navedit'); ?>'"><span class="icon-plus-square-o"></span> 添加内容</button>
		</div>
		<form method="post" action="" id="listform">
			<table class="table table-hover text-center">
				<tr>
					<th width="10%">ID</th>
					<th width="10%">排序</th>
					<th width="15%">名称</th>
					<th width="15%">操作</th>
				</tr>
				<?php if(is_array($data) || $data instanceof \think\Collection): if( count($data)==0 ) : echo "" ;else: foreach($data as $key=>$v): ?>
				<tr>
					<td><input type="checkbox" name="nav_id[]" value="<?php echo $v['nav_id']; ?>" /><?php echo $v['nav_id']; ?></td>
					<td><input type="text" name="nav_sort[<?php echo $v['nav_id']; ?>]" value="<?php echo $v['nav_sort']; ?>" style="width:50px; text-align:center; border:1px solid #ddd; padding:7px 0;"></td>     
					<td><?php echo $v['nav_name']; ?></td>
					<td><div class="button-group">
						<a class="button border-main" href="<?php echo url('navedit',['nav_id' => $v['nav_id']]); ?>"><span class="icon-edit"></span> 修改</a>
						<a class="button border-red" href="<?php echo url('navdelete',['nav_id' => $v['nav_id']]); ?>" onclick="if(confirm('确定删除?')==false)return false;"><span class="icon-trash-o"></span> 删除</a>
					</div></td>
				</tr>
				<?php endforeach; endif; else: echo "" ;endif; ?>
				<tr>
					<td><input type="checkbox" id="checkall"/>
					全选 </td>
					<td colspan="5" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 排序</a></td>
				</tr>
			</table>
			<input type="hidden" name="status" value="">
		</form>
	</div>
</body></html>
<script>
  //全选
	$("#checkall").click(function(){ 
		$("input[name='nav_id[]']").each(function(){
			if (this.checked) {
				this.checked = false;
			}
			else {
				this.checked = true;
			}
		});
	});

//批量删除
	function DelSelect(){
		var Checkbox=false;
		$("input[name='nav_id[]']").each(function(){
			if (this.checked==true) {   
				Checkbox=true;  
			}
		});
		if (Checkbox){
			var t=confirm("您确认要删除选中的内容吗？");
			if (t==false) return false;   
			$('input[name=status]').val('del');
			$("#listform").submit();    
		}
		else{
			alert("请选择您要删除的内容!");
			return false;
		}
	}

//批量排序
	function sorts(){
		var Checkbox=false;
		$("input[name='nav_id[]']").each(function(){
			if (this.checked==true) {   
				Checkbox=true;  
			}
		});
		if (Checkbox){  
			$('input[name=status]').val('sort');
			$("#listform").submit();    
		}
		else{
			alert("请选择要操作的内容!");
			return false;
		}
	}
</script>